<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-civilized-dormitory-add">
			<div class="form-group">	
				<label class="col-sm-3 control-label">宿舍号：</label>
				<div class="col-sm-8">
					<select id="dormNumbers" name="dormNumbers" class="form-control" data-placeholder="可一次选择多个" multiple>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">对应日期：</label>
				<div class="col-sm-8">
					<input id="belongDate" name="belongDate" class="form-control" type="text" placeholder="不填写着默认使用今天的日期">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<input id="remark" name="remark" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<div class="form-control-static col-sm-offset-9">
					<button type="submit" class="btn btn-primary">提交</button>
					<button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script th:src="@{/ajax/libs/select/select2.js}"></script>
    <script type="text/javascript">
		$(function(){
			
			var prefix = ctx + "module/teacher/civilized-dormitory"

			layui.use('laydate', function(){
			    var laydate = layui.laydate;
			    laydate.render({
			    	elem: '#belongDate'
			    });
			});
			
			$("#form-civilized-dormitory-add").validate({
				rules:{
					xxxx:{
						required:true,
					},
				},
				submitHandler: function(form) {
					$.operate.save(prefix + "/add", $(form).serialize());
				}
			});
			
			$("#dormNumbers").select2({
				ajax: {
			        type:'GET',
			        url: perfix + "/queryDormFormatSelect2",
			        delay: 250,
			        cache: true,
			        processResults: function (data, params) {
			        	data.results.forEach(function(item){
			        		item.id = item.text;
			        	});
			        	return data;
				    }
			    }, 
			});
		})
	</script>
</body>
</html>
